package com.vehicle.controller;


import com.vehicle.bean.DataGridView;
import com.vehicle.mapper.RtypeMapper;
import com.vehicle.pojo.Remind;
import com.vehicle.pojo.Rtype;
import com.vehicle.service.RemindService;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/remind")
public class RemindController {

    @Autowired
    private RemindService remindService;
    @Autowired
    private RtypeMapper rtypeMapper;
    private Logger logger=Logger.getLogger(this.getClass());

    @ResponseBody
    @RequestMapping("/list")
    public DataGridView list(Remind remind,Integer rtypeid){
        Rtype rtype=new Rtype();
        rtype.setRtypeid(rtypeid);
        remind.setRtype(rtype);
        logger.info(remind);
        return remindService.findAll(remind);
    }

    @ResponseBody
    @RequestMapping("/allList")
    public DataGridView allRemind(){
        return remindService.findAllRemind();
    }

    @RequestMapping("/selectRtype")
    @ResponseBody
    public List<Rtype> selectRtype(){
        return rtypeMapper.selectALll();
    }
}
